#ifndef USERPROXYIMP_H
#define USERPROXYIMP_H

#include <QObject>
#include <QDialog>
#include <sailmipim/core/iuserproxy.h>
namespace SailmiPIM::Plugin::UserProxy
{
class UserProxyImp :public QObject,public IUserProxy
{
    Q_OBJECT
public:
    explicit UserProxyImp(QObject *parent = nullptr);
    UserInfo* login(QString userName,QString userPass) override;
    QDialog* getLoginDialog(QWidget *parent,UserInfo *userInfo) override;
    QDialog* getRegisterDialog(QWidget *parent,UserInfo *userInfo) override;
    UserInfo* parseUserTokenJson(QString userJson);
    UserInfo* parseUserAuthJson(QString userJson);
    UserInfo* registerUser(UserInfo *userInfo);
private:
    QString apiHostUrl = "http://47.105.55.33:16800";
    QString apiTokenUrl = apiHostUrl+"/auth-service/token";
    QString apiRegisterUrl = apiHostUrl+"/auth-service/register";
};
}
#endif // USERPROXYIMP_H
